package frontend.parser.node.decl;

import frontend.parser.node.Node;

public class Decl extends Node {
    // 声明  Decl → ConstDecl | VarDecl
    private DeclType declType;
    private ConstDecl constDecl;
    private VarDecl varDecl;
    public enum DeclType {
        CONST_DECL, VAR_DECL;
    }

    public void addConstDecl(ConstDecl constDecl) {
        super.add(constDecl);
        declType = DeclType.CONST_DECL;
        this.constDecl = constDecl;
    }

    public void addVarDecl(VarDecl varDecl) {
        super.add(varDecl);
        declType = DeclType.VAR_DECL;
        this.varDecl = varDecl;
    }

    public DeclType getDeclType() {
        return declType;
    }

    public ConstDecl getConstDecl() {
        return constDecl;
    }

    public VarDecl getVarDecl() {
        return varDecl;
    }

}
